﻿using System;

namespace SharpObjects.Data.EntityMapping
{
    public class MappingAttribute : Attribute
    {
        public MappingAttribute(string dbColumn)
        {
            this.DbColumn = dbColumn;
            this.DbTable = null;
        }

        public MappingAttribute(string dbColumn, bool isPrimaryKey, string dbTable, int dbTableOrder)
        {
            this.DbColumn = dbColumn;
            this.IsPrimaryKey = isPrimaryKey;
            this.DbTable = dbTable;
            this.DbTableOrder = dbTableOrder;
        }

        [Obsolete("Mapping property is obsolete - use DbColumn instead.")]
        public string Mapping
        {
            get { return this.DbColumn; }
            set { this.DbColumn = value; }
        }

        public string DbColumn { get; set; }
        public string DbTable { get; set; }
        public int DbTableOrder { get; set; }
        public bool IsPrimaryKey { get; set; }
    }
}
